package com.shanghaiyimu.yimiyangche.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.shanghaiyimu.yimiyangche.R;
import com.shanghaiyimu.yimiyangche.bean.GoodsSeclectListBeen;
import com.shanghaiyimu.yimiyangche.widget.SelcetViewWithText;

import java.util.List;

/**
 * Author:ShangHaiYiMu
 * Time:2017/7/17   13:43
 * Description:GoodsContentListViewAdapter
 */

public class GoodsContentListViewAdapter extends BaseAdapter {
    private Context context;
    private List<GoodsSeclectListBeen> datas;

    public GoodsContentListViewAdapter(Context context, List<GoodsSeclectListBeen> datas) {
        this.context = context;
        this.datas = datas;
    }

    @Override
    public int getCount() {
        return datas!=null?datas.size():0;
    }

    @Override
    public Object getItem(int position) {
        return datas.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null){
            convertView = LayoutInflater.from(context).inflate(R.layout.selectgoodsi_tem,parent,false);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        }{
            holder = (ViewHolder) convertView.getTag();
        }
        holder.title.setText(datas.get(position).getTitle());




        return convertView;
    }
    static class ViewHolder{

        private TextView title;
        private SelcetViewWithText selcetViewWithText;

        public ViewHolder(View view) {

            title = (TextView) view.findViewById(R.id.seclet_title);
            selcetViewWithText = (SelcetViewWithText) view.findViewById(R.id.selcetview_item);
        }
    }

}
